package app.esb.res;

import app.esb.disk.DiskExcutor;
import cn.lily.com.db.DBFactory;
import cn.lily.com.db.container.reader.DataTable;
/**
 * 资源处理类
 * @author JiaJ
 * @date 2017年12月2日
 *
 */
public class ResExcutor {
	
	/**
	 * 删除磁盘资源信息
	 * @param resID
	 */
	public static void delResDisk(String resID){
		
		 DataTable resTable = DBFactory.getActionDB().executeQueryTable("select * from ${schema}.LEO_RES_INFO where RES_ID='"+resID+"'");
		 
		 if(resTable.getRecordCount() <= 0){
			 return;
		 }
		 
		 resTable.next();
		 String delSize = resTable.getString("RES_STORE_SIZE");
		 String diskID = resTable.getString("DISK_ID");
				 
		 DiskExcutor de = new DiskExcutor(diskID);
		 de.delSize(delSize);
		 de.excute();
		 
	}
	
	/**
	 * 添加磁盘资源信息
	 * @param resID
	 */
	public static void addResDisk(String resID){
		 DataTable resTable = DBFactory.getActionDB().executeQueryTable("select * from ${schema}.LEO_RES_INFO where RES_ID='"+resID+"'");
		 resTable.next();
		 String delSize = resTable.getString("RES_STORE_SIZE");
		 String diskID = resTable.getString("DISK_ID");
				 
		 DiskExcutor de = new DiskExcutor(diskID);
		 de.addSize(delSize);
		 de.excute();
	}
	
}
